class Student:
    school = '大山教育'

    # 初始化方法
    def __init__(self, name, age, score):
        self.name = name
        self.age = age
        self.score = score

    # 定义在类中的函数，称为方法，自带一个参数self
    def show(self):
        print('我是{0}。今年{1}多少岁。得了{2}分'.format(self.name, self.age, self.score))


# main
if __name__ == '__main__':
    stu = Student('马迪迪', 23, 88.5)
    stu.school = '爽鑫互联'
    stu.show()
    print(stu.school)
    print(stu.name, stu.age, stu.score)
    stu1 = Student('小红', 28, 95.5)
    stu1.school = '大山科技'
    stu1.show()
    print(stu1.school)
    print(stu1.name, stu1.age, stu1.score)

    # 动态绑定属性
    stu.sort = 1
    print(stu.sort)
    # print(stu1.sort) # 如果没赋值就会有异常 'Student' object has no attribute 'sort'. Did you mean: 'score'?
    # 动态绑定方法
    def introduce():
        print('我是一个普通函数，我被动态绑定成了stu1对象上的方法')

    # 函数赋值
    stu1.introduceFunc = introduce
    # 打点调用
    stu1.introduceFunc()

